@extends('index')

@section('content')
<h3>以往订单</h3>
      <div id="JTable"></div>
@stop

@section("script")
<script type="text/javascript">
	$(function(){
  $(".menu .caiwu-item").toggleClass("hidden");
  $("#ywdingdan").addClass("active");
  $('#JTable').jtable({
    title: '品牌管理',
    actions: {
        listAction: '/getorderlist',
        // createAction: '/addcompany',
        // updateAction: '/editecompany',
        // deleteAction: '/deletecompany'
    },
    fields: {
        id: {
            key: true,
            list: false
        },
        姓名: {
            title: '姓名',
        },
        性别: {
            options: { 1: '男', 2: '女', 0: '未定义' },
            title: '性别',
        },
        地址: {
            title: '地址',

        },
        电话: {
            title: '电话',
        },
        年龄: {
            title: '年龄',
        },
        Exams: {
                    title: '',
                    width: '2%',
                    sorting: false,
                    edit: false,
                    create: false,
                    display: function (tabledata) {
                        //Create an image that will be used to open child table
                        var $img = $('<img src="/extra.png" title="查看详情" />');
                        //Open child table when user clicks the image
                        $img.click(function () {
                            $('#JTable').jtable('openChildTable',
                                    $img.closest('tr'), //Parent row
                                    {
                                    title:  '详细信息',
                                    actions: {
                                        listAction: '/getselldetail?sellid='+tabledata.record.id,
                                        // deleteAction: '/Demo/DeleteExam',
                                        // updateAction: '/Demo/UpdateExam',
                                        // createAction: '/Demo/CreateExam'
                                    },
                                    fields: {
                                        订单号: {
                                          title:"订单号"
                                        },
                                        车型: {
                                          title: '车型',
                                          options: '/getcars'
                                          },
                                        数量: {
                                          title: '数量',
                                        },
                                        售价: {
                                          title: '售价',
                                        }
                                    }
                                }, function (data) { //opened handler
                                    data.childTable.jtable('load');
                                });
                        });
                        //Return image to show on the person row
                        return $img;
                    }
                },
    }
  });
  $('#JTable').jtable('load');

});
</script>
@stop